// 生成计算数字的多少次幂的函数
function makePower (power){
    return function(x){
        return Math.pow(x,power)
    }
}

let pow2=makePower(2)
let pow3=makePower(3)

console.log(pow2(4))
console.log(pow3(4))

function makeSalary(x){
    return function(y){
        return x+y
    }
}

let salaryLevel1=makeSalary(1500)
let salaryLevel2=makeSalary(2000)

console.log(salaryLevel1(2000))
console.log(salaryLevel2(4000))

let numbers=[1,2,3,4,5]
// 纯函数
console.log(numbers.slice(0,3))

